var _extends=Object.assign||function(e){for(var t=1;t-1&&(!function(e,t){var n=function n(s){u(s,!0,t),l(e,n,r)},r=function r(s){u(s,!1,t),l(e,n,r)};e.addEventListener("load",n),e.addEventListener("error",r)}(e,t),i(e,t.class_loading)),r(e,t),function(e,t,n){e.setAttribute("data-"+t,n)}(e,"was-processed",!0),c(t.callback_set,e)},f=function(e,t){this._settings=function(e){var t={elements_selector:"img",container:document,threshold:300,data_src:"src",data_srcset:"srcset",class_loading:"loading",class_loaded:"loaded",class_error:"error",callback_load:null,callback_error:null,callback_set:null,callback_enter:null};return _extends({},t,e)}(e),this._setObserver(),this.update(t)};f.prototype={_setObserver:function(){var e=this;if(o){var n=this._settings,r={root:n.container===document?null:n.container,rootMargin:n.threshold+"px"};this._observer=new IntersectionObserver(function(n){n.forEach(function(t){if(function(e){return e.isIntersecting||e.intersectionRatio>0}(t)){var n=t.target;d(n,e._settings),e._observer.unobserve(n)}}),e._elements=t(e._elements)},r)}},update:function(e){var n=this,r=this._settings,s=e||r.container.querySelectorAll(r.elements_selector);this._elements=t(Array.prototype.slice.call(s)),this._observer?this._elements.forEach(function(e){n._observer.observe(e)}):(this._elements.forEach(function(e){d(e,r)}),this._elements=t(this._elements))},destroy:function(){var e=this;this._observer&&(t(this._elements).forEach(function(t){e._observer.unobserve(t)}),this._observer=null),this._elements=null,this._settings=null}};var _=window.WCDP_LazyLoadOptions;return s&&_&&function(e,t){if(t.length)for(var r,s=0;r=t[s];s+=1)n(e,r);else n(e,t)}(f,_),f});